package com.example.rxjava.ui

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.example.rxjava.extend.toast
import com.example.rxjava.utils.DataStoreManager
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch

class SecondActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        var data: String
        CoroutineScope(Dispatchers.Main).launch {
            DataStoreManager.get().saveString("data_second", "second")
            data = DataStoreManager.get().getString("data_main")
            toast(data)
        }
    }

}